<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
JPluginHelper::importPlugin('content');
$dispatcher	= JDispatcher::getInstance();
if (!class_exists('plgContentLightShop')) {
	JError::raiseWarning(50, str_rot13('WYVO_FUBC_REEBE_YBNQ_CYHTVA'));
}
$count = count($this->items);
$_row = ceil($count/$this->state->get('page.columns'));
$_column = $this->state->get('page.columns');
$per = floor(100/$_column);
?>
<link rel="stylesheet" href="<?php echo JURI::root().'components/com_shop/assets/'; ?>style.css" type="text/css" />
<?php if($this->state->get('page.show_page_heading')):?>
<div class="item_page_title">
<h2><?php echo $this->state->get('page.page_title'); ?></h2>
</div>
<?php endif;?>
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="shop-home-table">
<tbody>
	<?php for($i = 0 ; $i < $_row ; $i++):?>
    <tr>
    	<?php for($j = 0 ; $j < $_column; $j++):?>
        	<?php if(isset($this->items[$i*$_column+$j])):
			$item = $this->items[$i*$_column+$j];
$link = JRoute::_('index.php?option=com_shop&view=detail&id='.$item->id.':'.$item->alias);
			?>
            <td width="<?php echo $per; ?>%" valign="top">
            <div class="shop-home-item-p">
            	<a href="<?php echo $link; ?>" title="<?php echo $item->title; ?>"><img src="<?php echo $this->path_img.'thumb/'.$item->image; ?>" alt="<?php echo $item->alias; ?>" title="<?php echo $item->title; ?>" width="<?php echo $this->state->get('product.widthimg'); ?>" height="<?php echo $this->state->get('product.heightimg'); ?>" class="shop-home-pape-img" /></a>
                <div class="item_p_title"><h2><a href="<?php echo $link; ?>" class="hasTip" title="<?php echo $this->state->get('page.page_title').'::'.$item->title; ?>"><?php echo $item->title; ?></a></h2>
                </div>
                 <?php if($this->state->get('product.introtext')):?>
                <div class="shop-home-introtext">
<?php 
$introtext = $item->introtext; $dispatcher->trigger('takeShortText',array(&$introtext,$this->state->get('product.numberword'))); echo $introtext;
?>
                </div>
                <?php endif;?>
<?php if($this->state->get('product.price')):?>
<div class="shop-home-price">
                <strong><?php echo JText::_('PRICE'); ?>: </strong><?php 
$price = $item->price; $dispatcher->trigger('onFormatPrice',array($price,$item->currency,&$price)); echo $price;
?> </div>
<?php endif;?>
<?php if($this->state->get('product.oldprice')):?>
<div class="shop-home-old-price">
                <strong><?php echo JText::_('OLD PRICE'); ?>: </strong><?php 
$oldprice = $item->old_price; $dispatcher->trigger('onFormatPrice',array($oldprice,$item->currency,&$oldprice)); echo $oldprice;
?> </div>
<?php endif;?>
<?php if($this->state->get('product.button')):?>
<div class="shop-home-button">
<div class="shop-home-button-lft">
<a href="<?php echo JRoute::_('index.php?option=com_shop&view=order&id='.$item->id.':'.$item->alias); ?>" title="<?php echo $item->title; ?>" class="shop-home-button-order"><?php echo JText::_('ORDER'); ?></a>
</div>
<div class="shop-home-button-rgt">
<a href="<?php echo $link; ?>" title="<?php echo $item->title; ?>" class="shop-home-button-detail"><?php echo JText::_('DETAIL'); ?></a>
</div>
</div>
<?php endif;?>
            </div>
            </td>
            <?php else:?>
            <td width="<?php echo $per;?>%"></td>
            <?php endif;?>
        <?php endfor;?>
    </tr>
    <?php endfor;?>
</tbody>
<tfoot>
<tr>
	<td colspan="<?php echo $_column; ?>"><?php echo $this->pagination->getPagesLinks(); ?></td>
</tr>
</tfoot>
</table>